package blog.spring.db.entity;

// Generated 2015-1-30 0:04:13 by Hibernate Tools 4.0.0

import static javax.persistence.GenerationType.IDENTITY;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.fasterxml.jackson.annotation.JsonIgnore;

/**
 * User generated by hbm2java
 */
@Entity
@Table(name = "user", catalog = "blog")
public class User implements java.io.Serializable {

	private Integer userId;
	@JsonIgnore
	private Cfg cfg;
	private String userName;
	private String passWord;
	private String nickName;
	private String email;
	private String headUrl;
	private String headPath;
	private String info;
	private String userPage;
	private Date loginDate;
	private String loginIp;
	@JsonIgnore
	private CmsUser cmsUser;
	@JsonIgnore
	private SysUser sysUser;
	@JsonIgnore
	private Set<Cfg> cfgs = new HashSet<Cfg>(0);
	@JsonIgnore
	private Set<Comment> comments = new HashSet<Comment>(0);
	@JsonIgnore
	private Set<ArticleInfo> articleInfos = new HashSet<ArticleInfo>(0);

	public User() {
	}

	public User(Integer userId) {
		super();
		this.userId = userId;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "user_id", unique = true, nullable = false)
	public Integer getUserId() {
		return this.userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}

	@OneToOne(fetch = FetchType.LAZY, mappedBy = "user", cascade = CascadeType.ALL)
	@PrimaryKeyJoinColumn
	public CmsUser getCmsUser() {
		return this.cmsUser;
	}

	public void setCmsUser(CmsUser cmsUser) {
		this.cmsUser = cmsUser;
		if (cmsUser != null)
			this.cmsUser.setUser(this);
	}

	@OneToOne(fetch = FetchType.LAZY, mappedBy = "user", cascade = CascadeType.ALL)
	@PrimaryKeyJoinColumn
	public SysUser getSysUser() {
		return this.sysUser;
	}

	public void setSysUser(SysUser sysUser) {
		this.sysUser = sysUser;
		if (sysUser != null)
			this.sysUser.setUser(this);
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "cfg_id")
	public Cfg getCfg() {
		return this.cfg;
	}

	public void setCfg(Cfg cfg) {
		this.cfg = cfg;
	}

	@Column(name = "user_name")
	public String getUserName() {
		return this.userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	@Column(name = "pass_word")
	public String getPassWord() {
		return this.passWord;
	}

	public void setPassWord(String passWord) {
		this.passWord = passWord;
	}

	@Column(name = "nick_name")
	public String getNickName() {
		return this.nickName;
	}

	public void setNickName(String nickName) {
		this.nickName = nickName;
	}

	@Column(name = "email")
	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@Column(name = "head_url")
	public String getHeadUrl() {
		return this.headUrl;
	}

	public void setHeadUrl(String headUrl) {
		this.headUrl = headUrl;
	}

	@Column(name = "head_path")
	public String getHeadPath() {
		return this.headPath;
	}

	public void setHeadPath(String headPath) {
		this.headPath = headPath;
	}

	@Column(name = "info")
	public String getInfo() {
		return this.info;
	}

	public void setInfo(String info) {
		this.info = info;
	}

	@Column(name = "user_page")
	public String getUserPage() {
		return this.userPage;
	}

	public void setUserPage(String userPage) {
		this.userPage = userPage;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "login_date", length = 19)
	public Date getLoginDate() {
		return this.loginDate;
	}

	public void setLoginDate(Date loginDate) {
		this.loginDate = loginDate;
	}

	@Column(name = "login_ip")
	public String getLoginIp() {
		return this.loginIp;
	}

	public void setLoginIp(String loginIp) {
		this.loginIp = loginIp;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "user")
	public Set<Cfg> getCfgs() {
		return this.cfgs;
	}

	public void setCfgs(Set<Cfg> cfgs) {
		this.cfgs = cfgs;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "user")
	public Set<Comment> getComments() {
		return this.comments;
	}

	public void setComments(Set<Comment> comments) {
		this.comments = comments;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "user")
	public Set<ArticleInfo> getArticleInfos() {
		return this.articleInfos;
	}

	public void setArticleInfos(Set<ArticleInfo> articleInfos) {
		this.articleInfos = articleInfos;
	}

}
